﻿using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Lab.Client;
using Microsoft.TeamFoundation.TestManagement.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace HybridLab.Workflow.Activities.UI
{
	public static class WizardUtils
	{
		public static ErrorProvider CreateErrorProvider(Control control)
		{
			if (control == null)
			{
				throw new ArgumentNullException("control");
			}
			ErrorProvider provider = new ErrorProvider();
			provider.SetIconPadding(control, 4);
			provider.BlinkStyle = ErrorBlinkStyle.NeverBlink;
			return provider;
		}

		public static LabEnvironment GetLab(this ITestEnvironment environment, TfsTeamProjectCollection server)
		{
			if (environment == null)
			{
				return null;
			}

			var labService = server.GetService<LabService>();
			return labService.GetLabEnvironment(environment.LabEnvironmentUri);
		}
	}
}
